lib/repo-pull: Support retrying requests on transient network errors
authorPhilip Withnall <withnall@endlessm.com>
Tue, 22 May 2018 11:21:45 +0000 (12:21 +0100)
committerAtomic Bot <atomic-devel@projectatomic.io>
Wed, 30 May 2018 16:23:57 +0000 (16:23 +0000)
commit938055392fd455027a69398c441b992ae521aa87
tree4e09a965cdf4e866d9ee2e283a4d1dec9e051f89
parentf31087137ed2ce23b8cd886f2ab37b0b27cbfc61
lib/repo-pull: Support retrying requests on transient network errors

Allow network requests to be re-queued if they failed with a transient
error, such as a socket timeout. Retry each request up to a limit
(default: 5), and only then fail the entire pull and propagate the error
to the caller.

Add a new ostree_repo_pull_with_options() option, n-network-retries, to
control the number of retries (including setting it back to the old
default of 0, if the caller wants).

Currently, retries are not supported for FetchDeltaSuperData requests,
as they are not queued. Once they are queued, adding support for retries
should be trivial. A FIXME comment has been left for this.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #1594
Approved by: jlebon
src/libostree/ostree-fetcher-util.c
src/libostree/ostree-fetcher-util.h
src/libostree/ostree-metalink.c
src/libostree/ostree-metalink.h
src/libostree/ostree-repo-pull.c